﻿// ***********************************************************************
// Assembly         : INNOVACALL.Framework.Common
// Author           : LJO+01 (Laurent Jordi)
// Created          : 06-05-2013
// Last Modified By : LJO+01 (Laurent Jordi)
// Last Modified On : 06-05-2013
// ***********************************************************************
// <copyright file="Language_MetaModel.cs" company="Copyright © Innovacall 2011">
//     Copyright (c) Copyright © Innovacall 2011. All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************
using System.Configuration;
using System.Globalization;
using System.IO;
using System.Threading;

namespace INNOVACALL.Framework.Common.Models.ViewModels.MetaModels
{
    /// <summary>
    /// Class Language_MetaModel
    /// </summary>
    public class Language_MetaModel
    {
        /// <summary>
        /// Language as fr-fr
        /// </summary>
        /// <value>The language.</value>
        public string Language { get; set; }

        /// <summary>
        /// Two last letter of the language
        /// </summary>
        /// <value>The id.</value>
        public string Id
        {
            get
            {
                return this.Language.Substring(3, 2);
            }
        }

        /// <summary>
        /// Id for the HTML Language Selector
        /// </summary>
        /// <value>The selector id.</value>
        public string SelectorId
        {
            get
            {
                return string.Format("lgSelector{0}", this.Id);
            }
        }

        /// <summary>
        /// Language country flag
        /// </summary>
        /// <value>The flag.</value>
        public string Flag
        {
            get
            {
                string toReturn = string.Empty;
                toReturn = string.Format("{0}/{1}.png", ConfigurationManager.AppSettings["LanguageFlagsFolder"], this.Id);
                return toReturn;
            }
        }

        /// <summary>
        /// Neutral contructor necessary for mapping
        /// </summary>
        public Language_MetaModel() : base() { }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="language">like fr-fr</param>
        public Language_MetaModel(string language)
        {
            this.Language = language;
        }
    }
}